package com.example.practica3enraya;

import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MyListener implements OnClickListener{
	private Activity activ;
	
	public MyListener (Activity main){
		this.activ = main;
	}
	
	public void onClick(View v) {
		Button b = (Button)v;
		
		switch (b.getId()) {
		case R.id.A1: 
			((MainActivity)activ).accion(((MainActivity)activ).A1);
			break;
		case R.id.A2: 
			((MainActivity)activ).accion(((MainActivity)activ).A2);
			break;
		case R.id.A3: 
			((MainActivity)activ).accion(((MainActivity)activ).A3);
			break;
		case R.id.B1: 
			((MainActivity)activ).accion(((MainActivity)activ).B1);
			break;
		case R.id.B2: 
			((MainActivity)activ).accion(((MainActivity)activ).B2);
			break;
		case R.id.B3: 
			((MainActivity)activ).accion(((MainActivity)activ).B3);
			break;
		case R.id.C1: 
			((MainActivity)activ).accion(((MainActivity)activ).C1);
			break;
		case R.id.C2: 
			((MainActivity)activ).accion(((MainActivity)activ).C2);
			break;
		case R.id.C3: 
			((MainActivity)activ).accion(((MainActivity)activ).C3);
			break;
		case R.id.radio1: 
			((MainActivity)activ).setMaquina(2);
			break;
		case R.id.radio2:	
			((MainActivity)activ).setMaquina(1);
			break;
		
		default:
			break;
		}
		
	}

}